<script>
    var audio_in = document.getElementById("in");
    var audio_search = document.getElementById("search");
    var audio_stop = document.getElementById("stop");
    var audio_bg = document.getElementById("audio_bg");

    var searchPlayFlag = false;

    audio_in.load();
    audio_search.load();
    audio_stop.load();
    audio_bg.load();
    audio_bg.play();

    $("#audio_bg").on("ended", function () {
        audio_bg.pause();
        audio_bg.play();
    })

    $("#search").on("ended", function () {
        if (searchPlayFlag) {
            audio_search.pause();
            audio_search.play();
        }
    })

    var isAudio = false
    var fixaudio = function () {
        if (!isAudio) {
            isAudio = true;
            audio_in.load();
            audio_search.load();
            audio_stop.load();
            audio_bg.load();
//            audio_in = new Audio();
//            audio_search = new Audio();
//            audio_stop = new Audio();
//            audio_bg = new Audio();
//
//            audio_in.src = "/ani/media/in.mp3";
//            audio_search.src = "/ani/media/search.mp3";
//            audio_stop.src = "/ani/media/stop.mp3";
//            audio_bg.src = "/ani/media/bg.mp3";

//            audio_bg.loop = true;
            audio_bg.play();

            $("document").off("tap");
        }
    };
    $("document").on("tap", function () {
        fixaudio();
    })

    $("document").trigger("tap");

    var play_in = function () {
        if (browser.versions.android) return;
//        audio_in.play();
    }

    var play_search = function () {
        if (browser.versions.android) return;
//        searchPlayFlag = true;
//        audio_search.play();
    }

    var stop_search = function () {
        if (browser.versions.android) return;
//        searchPlayFlag = false;
//        audio_search.pause();
    }

    var play_stop = function () {
        if (browser.versions.android) return;
//        audio_stop.play();
    }

</script>